home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / PowerManager DDK 1.0f1 / Interfaces&Libraries / Interfaces / Components.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-08  |  22.0 KB  |  630 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Components.h
  3.  
  4.      Contains:    Component Manager Interfaces.
  5.  
  6.      Version:    System 8.5
  7.  
  8.      DRI:        Jim Batson
  9.  
  10.      Copyright:    © 1991-1999 by Apple Computer, Inc., all rights reserved.
  11.  
  12.      Warning:    *** APPLE INTERNAL USE ONLY ***
  13.                  This file may contain unreleased API's
  14.  
  15.      BuildInfo:    Built by:            Scott Johnson
  16.                  On:                    10/8/99 11:26 AM
  17.                  With Interfacer:    3.0d13   (MPW PowerPC)
  18.                  From:                Components.i
  19.                      Revision:        41
  20.                      Dated:            4/7/99
  21.                      Last change by:    dle
  22.                      Last comment:    Add wierd New/DisposeComponentFunctionUPP variant, and turn on
  23.  
  24.      Bugs:        Report bugs to Radar component "System Interfaces", "Latest"
  25.                  List the version information (from above) in the Problem Description.
  26.  
  27. */
  28. #ifndef __COMPONENTS__
  29. #define __COMPONENTS__
  30.  
  31. #ifndef __ERRORS__
  32. #include <Errors.h>
  33. #endif
  34.  
  35. #ifndef __MACTYPES__
  36. #include <MacTypes.h>
  37. #endif
  38.  
  39. #ifndef __MIXEDMODE__
  40. #include <MixedMode.h>
  41. #endif
  42.  
  43.  
  44.  
  45.  
  46. #if PRAGMA_ONCE
  47. #pragma once
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_IMPORT
  55. #pragma import on
  56. #endif
  57.  
  58. #if PRAGMA_STRUCT_ALIGN
  59.     #pragma options align=mac68k
  60. #elif PRAGMA_STRUCT_PACKPUSH
  61.     #pragma pack(push, 2)
  62. #elif PRAGMA_STRUCT_PACK
  63.     #pragma pack(2)
  64. #endif
  65.  
  66. enum {
  67.     kAppleManufacturer            = FOUR_CHAR_CODE('appl'),        /* Apple supplied components */
  68.     kComponentResourceType        = FOUR_CHAR_CODE('thng'),        /* a components resource type */
  69.     kComponentAliasResourceType    = FOUR_CHAR_CODE('thga')        /* component alias resource type */
  70. };
  71.  
  72. enum {
  73.     kAnyComponentType            = 0,
  74.     kAnyComponentSubType        = 0,
  75.     kAnyComponentManufacturer    = 0,
  76.     kAnyComponentFlagsMask        = 0
  77. };
  78.  
  79. enum {
  80.     cmpWantsRegisterMessage        = 1L << 31
  81. };
  82.  
  83. enum {
  84.     kComponentOpenSelect        = -1,                            /* ComponentInstance for this open */
  85.     kComponentCloseSelect        = -2,                            /* ComponentInstance for this close */
  86.     kComponentCanDoSelect        = -3,                            /* selector # being queried */
  87.     kComponentVersionSelect        = -4,                            /* no params */
  88.     kComponentRegisterSelect    = -5,                            /* no params */
  89.     kComponentTargetSelect        = -6,                            /* ComponentInstance for top of call chain */
  90.     kComponentUnregisterSelect    = -7,                            /* no params */
  91.     kComponentGetMPWorkFunctionSelect = -8                        /* some params */
  92. };
  93.  
  94. /* Component Resource Extension flags */
  95. enum {
  96.     componentDoAutoVersion        = (1 << 0),
  97.     componentWantsUnregister    = (1 << 1),
  98.     componentAutoVersionIncludeFlags = (1 << 2),
  99.     componentHasMultiplePlatforms = (1 << 3),
  100.     componentLoadResident        = (1 << 4)
  101. };
  102.  
  103.  
  104.  
  105. /* Set Default Component flags */
  106. enum {
  107.     defaultComponentIdentical    = 0,
  108.     defaultComponentAnyFlags    = 1,
  109.     defaultComponentAnyManufacturer = 2,
  110.     defaultComponentAnySubType    = 4,
  111.     defaultComponentAnyFlagsAnyManufacturer = (defaultComponentAnyFlags + defaultComponentAnyManufacturer),
  112.     defaultComponentAnyFlagsAnyManufacturerAnySubType = (defaultComponentAnyFlags + defaultComponentAnyManufacturer + defaultComponentAnySubType)
  113. };
  114.  
  115. /* RegisterComponentResource flags */
  116. enum {
  117.     registerComponentGlobal        = 1,
  118.     registerComponentNoDuplicates = 2,
  119.     registerComponentAfterExisting = 4,
  120.     registerComponentAliasesOnly = 8
  121. };
  122.  
  123.  
  124.  
  125. struct ComponentDescription {
  126.     OSType                             componentType;                /* A unique 4-byte code indentifying the command set */
  127.     OSType                             componentSubType;            /* Particular flavor of this instance */
  128.     OSType                             componentManufacturer;        /* Vendor indentification */
  129.     unsigned long                     componentFlags;                /* 8 each for Component,Type,SubType,Manuf/revision */
  130.     unsigned long                     componentFlagsMask;            /* Mask for specifying which flags to consider in search, zero during registration */
  131. };
  132. typedef struct ComponentDescription        ComponentDescription;
  133.  
  134.  
  135. struct ResourceSpec {
  136.     OSType                             resType;                    /* 4-byte code  */
  137.     short                             resID;                        /*              */
  138. };
  139. typedef struct ResourceSpec                ResourceSpec;
  140.  
  141. struct ComponentResource {
  142.     ComponentDescription             cd;                            /* Registration parameters */
  143.     ResourceSpec                     component;                    /* resource where Component code is found */
  144.     ResourceSpec                     componentName;                /* name string resource */
  145.     ResourceSpec                     componentInfo;                /* info string resource */
  146.     ResourceSpec                     componentIcon;                /* icon resource */
  147. };
  148. typedef struct ComponentResource        ComponentResource;
  149. typedef ComponentResource *                ComponentResourcePtr;
  150. typedef ComponentResourcePtr *            ComponentResourceHandle;
  151.  
  152. struct ComponentPlatformInfo {
  153.     long                             componentFlags;                /* flags of Component */
  154.     ResourceSpec                     component;                    /* resource where Component code is found */
  155.     short                             platformType;                /* gestaltSysArchitecture result */
  156. };
  157. typedef struct ComponentPlatformInfo    ComponentPlatformInfo;
  158.  
  159. struct ComponentResourceExtension {
  160.     long                             componentVersion;            /* version of Component */
  161.     long                             componentRegisterFlags;        /* flags for registration */
  162.     short                             componentIconFamily;        /* resource id of Icon Family */
  163. };
  164. typedef struct ComponentResourceExtension ComponentResourceExtension;
  165.  
  166. struct ComponentPlatformInfoArray {
  167.     long                             count;
  168.     ComponentPlatformInfo             platformArray[1];
  169. };
  170. typedef struct ComponentPlatformInfoArray ComponentPlatformInfoArray;
  171.  
  172. struct ExtComponentResource {
  173.     ComponentDescription             cd;                            /* registration parameters */
  174.     ResourceSpec                     component;                    /* resource where Component code is found */
  175.     ResourceSpec                     componentName;                /* name string resource */
  176.     ResourceSpec                     componentInfo;                /* info string resource */
  177.     ResourceSpec                     componentIcon;                /* icon resource */
  178.     long                             componentVersion;            /* version of Component */
  179.     long                             componentRegisterFlags;        /* flags for registration */
  180.     short                             componentIconFamily;        /* resource id of Icon Family */
  181.     long                             count;                        /* elements in platformArray */
  182.     ComponentPlatformInfo             platformArray[1];
  183. };
  184. typedef struct ExtComponentResource        ExtComponentResource;
  185.  
  186. struct ComponentAliasResource {
  187.     ComponentResource                 cr;                            /* Registration parameters */
  188.     ComponentDescription             aliasCD;                    /* component alias description */
  189. };
  190. typedef struct ComponentAliasResource    ComponentAliasResource;
  191. /*  Structure received by Component:        */
  192.  
  193. struct ComponentParameters {
  194.     UInt8                             flags;                        /* call modifiers: sync/async, deferred, immed, etc */
  195.     UInt8                             paramSize;                    /* size in bytes of actual parameters passed to this call */
  196.     short                             what;                        /* routine selector, negative for Component management calls */
  197.     long                             params[1];                    /* actual parameters for the indicated routine */
  198. };
  199. typedef struct ComponentParameters        ComponentParameters;
  200.  
  201. struct ComponentRecord {
  202.     long                             data[1];
  203. };
  204. typedef struct ComponentRecord            ComponentRecord;
  205.  
  206. typedef ComponentRecord *                Component;
  207.  
  208. struct ComponentInstanceRecord {
  209.     long                             data[1];
  210. };
  211. typedef struct ComponentInstanceRecord    ComponentInstanceRecord;
  212.  
  213. typedef ComponentInstanceRecord *        ComponentInstance;
  214.  
  215. struct RegisteredComponentRecord {
  216.     long                             data[1];
  217. };
  218. typedef struct RegisteredComponentRecord RegisteredComponentRecord;
  219.  
  220. struct RegisteredComponentInstanceRecord {
  221.     long                             data[1];
  222. };
  223. typedef struct RegisteredComponentInstanceRecord RegisteredComponentInstanceRecord;
  224. typedef RegisteredComponentInstanceRecord * RegisteredComponentInstanceRecordPtr;
  225.  
  226. typedef long                             ComponentResult;
  227. enum {
  228.     platform68k                    = 1,                            /* platform type (response from gestaltSysArchitecture) */
  229.     platformPowerPC                = 2,
  230.     platformInterpreted            = 3,
  231.     platformWin32                = 4
  232. };
  233.  
  234. enum {
  235.     platformIRIXmips            = 1000,
  236.     platformSunOSsparc            = 1100,
  237.     platformSunOSintel            = 1101,
  238.     platformLinuxppc            = 1200,
  239.     platformLinuxintel            = 1201,
  240.     platformAIXppc                = 1300,
  241.     platformNeXTIntel            = 1400,
  242.     platformNeXTppc                = 1401,
  243.     platformNeXTsparc            = 1402,
  244.     platformNeXT68k                = 1403
  245. };
  246.  
  247. enum {
  248.     mpWorkFlagDoWork            = (1 << 0),
  249.     mpWorkFlagDoCompletion        = (1 << 1),
  250.     mpWorkFlagCopyWorkBlock        = (1 << 2),
  251.     mpWorkFlagDontBlock            = (1 << 3),
  252.     mpWorkFlagGetProcessorCount    = (1 << 4),
  253.     mpWorkFlagGetIsRunning        = (1 << 6)
  254. };
  255.  
  256.  
  257. struct ComponentMPWorkFunctionHeaderRecord {
  258.     UInt32                             headerSize;
  259.     UInt32                             recordSize;
  260.     UInt32                             workFlags;
  261.     UInt16                             processorCount;
  262.     UInt8                             unused;
  263.     UInt8                             isRunning;
  264. };
  265. typedef struct ComponentMPWorkFunctionHeaderRecord ComponentMPWorkFunctionHeaderRecord;
  266. typedef ComponentMPWorkFunctionHeaderRecord * ComponentMPWorkFunctionHeaderRecordPtr;
  267. typedef CALLBACK_API( ComponentResult , ComponentMPWorkFunctionProcPtr )(void *globalRefCon, ComponentMPWorkFunctionHeaderRecordPtr header);
  268. typedef CALLBACK_API( ComponentResult , ComponentRoutineProcPtr )(ComponentParameters *cp, Handle componentStorage);
  269. typedef STACK_UPP_TYPE(ComponentMPWorkFunctionProcPtr)             ComponentMPWorkFunctionUPP;
  270. typedef STACK_UPP_TYPE(ComponentRoutineProcPtr)                 ComponentRoutineUPP;
  271. /*
  272.     The parameter list for each ComponentFunction is unique. It is
  273.     therefore up to users to create the appropriate procInfo for their
  274.     own ComponentFunctions where necessary.
  275. */
  276.  
  277. typedef UniversalProcPtr                 ComponentFunctionUPP;
  278. /*
  279.     For Carbon, we add NewComponentFunctionUPP and DisposeComponentFunctionUPP
  280.     calls that take a procInfo as their second parameter. This allows native
  281.     Component writers to easily write a Carbon compliant component. Note that
  282.     there is no InvokeComponentFunctionUPP, use the CallComponentFunction calls
  283.     with the UPP instead.
  284. */
  285. #if OPAQUE_UPP_TYPES
  286. EXTERN_API( ComponentFunctionUPP )
  287. NewComponentFunctionUPP            (ProcPtr                 userRoutine,
  288.                                  ProcInfoType             procInfo);
  289.  
  290. EXTERN_API( void )
  291. DisposeComponentFunctionUPP        (ComponentFunctionUPP     userUPP);
  292.  
  293. #else
  294. #define NewComponentFunctionUPP(userRoutine,procInfo)         (ComponentFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), (ProcInfoType)procInfo, GetCurrentArchitecture())
  295. #define DisposeComponentFunctionUPP(userUPP)                DisposeRoutineDescriptor(userUPP)
  296. #endif  /* OPAQUE_UPP_TYPES */
  297.  
  298. #if TARGET_RT_MAC_CFM
  299. /* 
  300.     CallComponentUPP is a global variable exported from InterfaceLib.
  301.     It is the ProcPtr passed to CallUniversalProc to manually call a component function.
  302. */
  303. extern UniversalProcPtr CallComponentUPP;
  304. #endif
  305.  
  306. #define ComponentCallNow( callNumber, paramSize ) \
  307.     FIVEWORDINLINE( 0x2F3C,paramSize,callNumber,0x7000,0xA82A )
  308.  
  309. /********************************************************
  310. *                                                        *
  311. *                  APPLICATION LEVEL CALLS                    *
  312. *                                                        *
  313. ********************************************************/
  314. /********************************************************
  315. * Component Database Add, Delete, and Query Routines
  316. ********************************************************/
  317. EXTERN_API( Component )
  318. RegisterComponent                (ComponentDescription *    cd,
  319.                                  ComponentRoutineUPP     componentEntryPoint,
  320.                                  short                     global,
  321.                                  Handle                 componentName,
  322.                                  Handle                 componentInfo,
  323.                                  Handle                 componentIcon)                        TWOWORDINLINE(0x7001, 0xA82A);
  324.  
  325. EXTERN_API( Component )
  326. RegisterComponentResource        (ComponentResourceHandle  cr,
  327.                                  short                     global)                                TWOWORDINLINE(0x7012, 0xA82A);
  328.  
  329. EXTERN_API( OSErr )
  330. UnregisterComponent                (Component                 aComponent)                            TWOWORDINLINE(0x7002, 0xA82A);
  331.  
  332. EXTERN_API( Component )
  333. FindNextComponent                (Component                 aComponent,
  334.                                  ComponentDescription *    looking)                            TWOWORDINLINE(0x7004, 0xA82A);
  335.  
  336. EXTERN_API( long )
  337. CountComponents                    (ComponentDescription *    looking)                            TWOWORDINLINE(0x7003, 0xA82A);
  338.  
  339. EXTERN_API( OSErr )
  340. GetComponentInfo                (Component                 aComponent,
  341.                                  ComponentDescription *    cd,
  342.                                  Handle                 componentName,
  343.                                  Handle                 componentInfo,
  344.                                  Handle                 componentIcon)                        TWOWORDINLINE(0x7005, 0xA82A);
  345.  
  346. EXTERN_API( long )
  347. GetComponentListModSeed            (void)                                                        TWOWORDINLINE(0x7006, 0xA82A);
  348.  
  349. EXTERN_API( long )
  350. GetComponentTypeModSeed            (OSType                 componentType)                        TWOWORDINLINE(0x702C, 0xA82A);
  351.  
  352. /********************************************************
  353. * Component Instance Allocation and dispatch routines
  354. ********************************************************/
  355. EXTERN_API( OSErr )
  356. OpenAComponent                    (Component                 aComponent,
  357.                                  ComponentInstance *    ci)                                    TWOWORDINLINE(0x702D, 0xA82A);
  358.  
  359. EXTERN_API( ComponentInstance )
  360. OpenComponent                    (Component                 aComponent)                            TWOWORDINLINE(0x7007, 0xA82A);
  361.  
  362. EXTERN_API( OSErr )
  363. CloseComponent                    (ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x7008, 0xA82A);
  364.  
  365. EXTERN_API( OSErr )
  366. GetComponentInstanceError        (ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700A, 0xA82A);
  367.  
  368. /********************************************************
  369. *                                                        *
  370. *                      CALLS MADE BY COMPONENTS              *
  371. *                                                        *
  372. ********************************************************/
  373. /********************************************************
  374. * Component Management routines
  375. ********************************************************/
  376. EXTERN_API( void )
  377. SetComponentInstanceError        (ComponentInstance         aComponentInstance,
  378.                                  OSErr                     theError)                            TWOWORDINLINE(0x700B, 0xA82A);
  379.  
  380. EXTERN_API( long )
  381. GetComponentRefcon                (Component                 aComponent)                            TWOWORDINLINE(0x7010, 0xA82A);
  382.  
  383. EXTERN_API( void )
  384. SetComponentRefcon                (Component                 aComponent,
  385.                                  long                     theRefcon)                            TWOWORDINLINE(0x7011, 0xA82A);
  386.  
  387. EXTERN_API( short )
  388. OpenComponentResFile            (Component                 aComponent)                            TWOWORDINLINE(0x7015, 0xA82A);
  389.  
  390. EXTERN_API( OSErr )
  391. OpenAComponentResFile            (Component                 aComponent,
  392.                                  short *                resRef)                                TWOWORDINLINE(0x702F, 0xA82A);
  393.  
  394. EXTERN_API( OSErr )
  395. CloseComponentResFile            (short                     refnum)                                TWOWORDINLINE(0x7018, 0xA82A);
  396.  
  397. EXTERN_API( OSErr )
  398. GetComponentResource            (Component                 aComponent,
  399.                                  OSType                 resType,
  400.                                  short                     resID,
  401.                                  Handle *                theResource)                        TWOWORDINLINE(0x7035, 0xA82A);
  402.  
  403. EXTERN_API( OSErr )
  404. GetComponentIndString            (Component                 aComponent,
  405.                                  Str255                 theString,
  406.                                  short                     strListID,
  407.                                  short                     index)                                TWOWORDINLINE(0x7036, 0xA82A);
  408.  
  409. EXTERN_API( Component )
  410. ResolveComponentAlias            (Component                 aComponent)                            TWOWORDINLINE(0x7020, 0xA82A);
  411.  
  412. /********************************************************
  413. * Component Instance Management routines
  414. ********************************************************/
  415. EXTERN_API( Handle )
  416. GetComponentInstanceStorage        (ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700C, 0xA82A);
  417.  
  418. EXTERN_API( void )
  419. SetComponentInstanceStorage        (ComponentInstance         aComponentInstance,
  420.                                  Handle                 theStorage)                            TWOWORDINLINE(0x700D, 0xA82A);
  421.  
  422. EXTERN_API( long )
  423. GetComponentInstanceA5            (ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700E, 0xA82A);
  424.  
  425. EXTERN_API( void )
  426. SetComponentInstanceA5            (ComponentInstance         aComponentInstance,
  427.                                  long                     theA5)                                TWOWORDINLINE(0x700F, 0xA82A);
  428.  
  429. EXTERN_API( long )
  430. CountComponentInstances            (Component                 aComponent)                            TWOWORDINLINE(0x7013, 0xA82A);
  431.  
  432. /* useful helper routines for convenient method dispatching */
  433. EXTERN_API( long )
  434. CallComponentFunction            (ComponentParameters *    params,
  435.                                  ComponentFunctionUPP     func)                                TWOWORDINLINE(0x70FF, 0xA82A);
  436.  
  437. EXTERN_API( long )
  438. CallComponentFunctionWithStorage (Handle                 storage,
  439.                                  ComponentParameters *    params,
  440.                                  ComponentFunctionUPP     func)                                TWOWORDINLINE(0x70FF, 0xA82A);
  441.  
  442. #if TARGET_CPU_PPC && TARGET_OS_MAC
  443. EXTERN_API( long )
  444. CallComponentFunctionWithStorageProcInfo (Handle         storage,
  445.                                  ComponentParameters *    params,
  446.                                  ProcPtr                 func,
  447.                                  long                     funcProcInfo);
  448.  
  449. #else
  450. #define CallComponentFunctionWithStorageProcInfo(storage, params, func, funcProcInfo ) CallComponentFunctionWithStorage(storage, params, func)
  451.  
  452. #endif  /* TARGET_CPU_PPC && TARGET_OS_MAC */
  453.  
  454. EXTERN_API( long )
  455. DelegateComponentCall            (ComponentParameters *    originalParams,
  456.                                  ComponentInstance         ci)                                    TWOWORDINLINE(0x7024, 0xA82A);
  457.  
  458. EXTERN_API( OSErr )
  459. SetDefaultComponent                (Component                 aComponent,
  460.                                  short                     flags)                                TWOWORDINLINE(0x701E, 0xA82A);
  461.  
  462. EXTERN_API( ComponentInstance )
  463. OpenDefaultComponent            (OSType                 componentType,
  464.                                  OSType                 componentSubType)                    TWOWORDINLINE(0x7021, 0xA82A);
  465.  
  466. EXTERN_API( OSErr )
  467. OpenADefaultComponent            (OSType                 componentType,
  468.                                  OSType                 componentSubType,
  469.                                  ComponentInstance *    ci)                                    TWOWORDINLINE(0x702E, 0xA82A);
  470.  
  471. EXTERN_API( Component )
  472. CaptureComponent                (Component                 capturedComponent,
  473.                                  Component                 capturingComponent)                    TWOWORDINLINE(0x701C, 0xA82A);
  474.  
  475. EXTERN_API( OSErr )
  476. UncaptureComponent                (Component                 aComponent)                            TWOWORDINLINE(0x701D, 0xA82A);
  477.  
  478. EXTERN_API( long )
  479. RegisterComponentResourceFile    (short                     resRefNum,
  480.                                  short                     global)                                TWOWORDINLINE(0x7014, 0xA82A);
  481.  
  482. EXTERN_API( OSErr )
  483. GetComponentIconSuite            (Component                 aComponent,
  484.                                  Handle *                iconSuite)                            TWOWORDINLINE(0x7029, 0xA82A);
  485.  
  486.  
  487. /********************************************************
  488. *                                                        *
  489. *              Direct calls to the Components                *
  490. *                                                        *
  491. ********************************************************/
  492. /* Old style names*/
  493.  
  494. EXTERN_API( long )
  495. ComponentFunctionImplemented    (ComponentInstance         ci,
  496.                                  short                     ftnNumber)                            FIVEWORDINLINE(0x2F3C, 0x0002, 0xFFFD, 0x7000, 0xA82A);
  497.  
  498. EXTERN_API( long )
  499. GetComponentVersion                (ComponentInstance         ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFC, 0x7000, 0xA82A);
  500.  
  501. EXTERN_API( long )
  502. ComponentSetTarget                (ComponentInstance         ci,
  503.                                  ComponentInstance         target)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFA, 0x7000, 0xA82A);
  504.  
  505. /* New style names*/
  506.  
  507. EXTERN_API( ComponentResult )
  508. CallComponentOpen                (ComponentInstance         ci,
  509.                                  ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFF, 0x7000, 0xA82A);
  510.  
  511. EXTERN_API( ComponentResult )
  512. CallComponentClose                (ComponentInstance         ci,
  513.                                  ComponentInstance         self)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFE, 0x7000, 0xA82A);
  514.  
  515. EXTERN_API( ComponentResult )
  516. CallComponentCanDo                (ComponentInstance         ci,
  517.                                  short                     ftnNumber)                            FIVEWORDINLINE(0x2F3C, 0x0002, 0xFFFD, 0x7000, 0xA82A);
  518.  
  519. EXTERN_API( ComponentResult )
  520. CallComponentVersion            (ComponentInstance         ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFC, 0x7000, 0xA82A);
  521.  
  522. EXTERN_API( ComponentResult )
  523. CallComponentRegister            (ComponentInstance         ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFFB, 0x7000, 0xA82A);
  524.  
  525. EXTERN_API( ComponentResult )
  526. CallComponentTarget                (ComponentInstance         ci,
  527.                                  ComponentInstance         target)                                FIVEWORDINLINE(0x2F3C, 0x0004, 0xFFFA, 0x7000, 0xA82A);
  528.  
  529. EXTERN_API( ComponentResult )
  530. CallComponentUnregister            (ComponentInstance         ci)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0xFFF9, 0x7000, 0xA82A);
  531.  
  532. EXTERN_API( ComponentResult )
  533. CallComponentGetMPWorkFunction    (ComponentInstance         ci,
  534.                                  ComponentMPWorkFunctionUPP * workFunction,
  535.                                  void **                refCon)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0xFFF8, 0x7000, 0xA82A);
  536.  
  537.  
  538. #if !TARGET_OS_MAC || forCarbon
  539. /* 
  540.         CallComponent is used by ComponentGlue routines to manually call a component function.
  541.      */
  542. EXTERN_API( ComponentResult )
  543. CallComponent                    (ComponentInstance         ci,
  544.                                  ComponentParameters *    cp);
  545.  
  546. #endif  /* !TARGET_OS_MAC || forCarbon */
  547.  
  548. /* UPP call backs */
  549. #if OPAQUE_UPP_TYPES
  550.     EXTERN_API(ComponentMPWorkFunctionUPP)
  551.     NewComponentMPWorkFunctionUPP    (ComponentMPWorkFunctionProcPtr userRoutine);
  552.  
  553.     EXTERN_API(ComponentRoutineUPP)
  554.     NewComponentRoutineUPP           (ComponentRoutineProcPtr    userRoutine);
  555.  
  556.     EXTERN_API(void)
  557.     DisposeComponentMPWorkFunctionUPP    (ComponentMPWorkFunctionUPP userUPP);
  558.  
  559.     EXTERN_API(void)
  560.     DisposeComponentRoutineUPP       (ComponentRoutineUPP        userUPP);
  561.  
  562.     EXTERN_API(ComponentResult)
  563.     InvokeComponentMPWorkFunctionUPP    (void *                globalRefCon,
  564.                                     ComponentMPWorkFunctionHeaderRecordPtr header,
  565.                                     ComponentMPWorkFunctionUPP userUPP);
  566.  
  567.     EXTERN_API(ComponentResult)
  568.     InvokeComponentRoutineUPP       (ComponentParameters *    cp,
  569.                                     Handle                    componentStorage,
  570.                                     ComponentRoutineUPP        userUPP);
  571.  
  572. #else
  573.     enum { uppComponentMPWorkFunctionProcInfo = 0x000003F0 };         /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  574.     enum { uppComponentRoutineProcInfo = 0x000003F0 };                 /* pascal 4_bytes Func(4_bytes, 4_bytes) */
  575.     #define NewComponentMPWorkFunctionUPP(userRoutine)                 (ComponentMPWorkFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppComponentMPWorkFunctionProcInfo, GetCurrentArchitecture())
  576.     #define NewComponentRoutineUPP(userRoutine)                     (ComponentRoutineUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppComponentRoutineProcInfo, GetCurrentArchitecture())
  577.     #define DisposeComponentMPWorkFunctionUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  578.     #define DisposeComponentRoutineUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  579.     #define InvokeComponentMPWorkFunctionUPP(globalRefCon, header, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppComponentMPWorkFunctionProcInfo, (globalRefCon), (header))
  580.     #define InvokeComponentRoutineUPP(cp, componentStorage, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppComponentRoutineProcInfo, (cp), (componentStorage))
  581. #endif
  582. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  583. #define NewComponentMPWorkFunctionProc(userRoutine)             NewComponentMPWorkFunctionUPP(userRoutine)
  584. #define NewComponentRoutineProc(userRoutine)                     NewComponentRoutineUPP(userRoutine)
  585. #define CallComponentMPWorkFunctionProc(userRoutine, globalRefCon, header) InvokeComponentMPWorkFunctionUPP(globalRefCon, header, userRoutine)
  586. #define CallComponentRoutineProc(userRoutine, cp, componentStorage) InvokeComponentRoutineUPP(cp, componentStorage, userRoutine)
  587. /* ProcInfos */
  588.  
  589. /* MixedMode ProcInfo constants for component calls */
  590. enum {
  591.     uppComponentFunctionImplementedProcInfo            = 0x000002F0,
  592.     uppGetComponentVersionProcInfo                    = 0x000000F0,
  593.     uppComponentSetTargetProcInfo                    = 0x000003F0,
  594.     uppCallComponentOpenProcInfo                    = 0x000003F0,
  595.     uppCallComponentCloseProcInfo                    = 0x000003F0,
  596.     uppCallComponentCanDoProcInfo                    = 0x000002F0,
  597.     uppCallComponentVersionProcInfo                    = 0x000000F0,
  598.     uppCallComponentRegisterProcInfo                = 0x000000F0,
  599.     uppCallComponentTargetProcInfo                    = 0x000003F0,
  600.     uppCallComponentUnregisterProcInfo                = 0x000000F0,
  601.     uppCallComponentGetMPWorkFunctionProcInfo        = 0x00000FF0
  602. };
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610. #if PRAGMA_STRUCT_ALIGN
  611.     #pragma options align=reset
  612. #elif PRAGMA_STRUCT_PACKPUSH
  613.     #pragma pack(pop)
  614. #elif PRAGMA_STRUCT_PACK
  615.     #pragma pack()
  616. #endif
  617.  
  618. #ifdef PRAGMA_IMPORT_OFF
  619. #pragma import off
  620. #elif PRAGMA_IMPORT
  621. #pragma import reset
  622. #endif
  623.  
  624. #ifdef __cplusplus
  625. }
  626. #endif
  627.  
  628. #endif /* __COMPONENTS__ */
  629.  
  630.